import React, { Component } from 'react'
import Alert from '@material-ui/lab/Alert'
import './MyAlert.less'
import {connect} from 'react-redux'

class MyAlert extends Component{
  render() {
     return (
    <div>
         <Alert variant="filled" style={{display: this.props.showToast ? 'flex' : 'none'}} severity={this.props.icon}>{ this.props.title }</Alert>
    </div>
  )
  }
}
const mapStateToProps = (state) => {
  return {
    showToast: state.showToast,
    icon: state.icon,
    title: state.title
  }
  
}

export default connect(mapStateToProps, null)(MyAlert)
